{include file="public/header" /}
<!-- 内容主体区域 -->
<div class="content">
    <div class="animated fadeIn">
        <div class="row">
            <div class="col-lg-6">
                <div class="card">
                    <div class="card-header">
                        <strong class="card-title">添加新美食</strong>
                    </div>
                    <div class="card-body">
                        <!-- Credit Card -->
                        <div id="pay-invoice">
                            <div class="card-body">
                                <div class="card-title">
                                    <h3 class="text-center">美食</h3>
                                </div>
                                <hr>
                                <form action="<?= url('doadd') ?>" method="post" novalidate="novalidate" enctype="multipart/form-data">
                                    <div class="form-group">
                                        <label for="cc-payment" class="control-label mb-1">标题</label>
                                        <input id="cc-payment" name="food_title" id="food_title" type="text" class="form-control">
                                    </div>
                                    <div class="form-group">
                                        <label for="cc-payment" class="control-label mb-1">内容</label>
                                        <textarea id="cc-payment" name="food_content" id="food_content" type="text" class="form-control"></textarea>
                                    </div>
                                     
                                        <input type="file" name="food_picture" onchange="showImg()" id="food_picture" style="float: left;margin-top: 8px;">
                                        
                                    <button id="payment-button" type="submit" class="btn btn-lg btn-info btn-block">
                                        <span id="payment-button-amount">提交</span>
                                    </button>
                                </form>

                            </div>
                        </div>
                    </div>
                </div> <!-- .card -->
            </div>
            <!--/.col-->
        </div>
    </div>
</div>
<!-- Scripts -->
<script src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.4/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery-match-height@0.7.2/dist/jquery.matchHeight.min.js"></script>
<script src="__STATIC__/js/main.js"></script>
<!--  Chart js -->
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.7.3/dist/Chart.bundle.min.js"></script>
<!--Chartist Chart-->
<script src="https://cdn.jsdelivr.net/npm/chartist@0.11.0/dist/chartist.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartist-plugin-legend@0.6.2/chartist-plugin-legend.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery.flot@0.8.3/jquery.flot.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/flot-pie@1.0.0/src/jquery.flot.pie.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/flot-spline@0.0.1/js/jquery.flot.spline.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/simpleweather@3.1.0/jquery.simpleWeather.min.js"></script>
<script src="__STATIC__/js/init/weather-init.js"></script>
<script src="https://cdn.jsdelivr.net/npm/moment@2.22.2/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@3.9.0/dist/fullcalendar.min.js"></script>
<script src="__STATIC__/js/init/fullcalendar-init.js"></script>
<!--Local Stuff-->
<script src="__STATIC__/layui/layui.js"></script>
<script>
layui.use(['element', 'layer', 'laypage'], function() {
    var element = layui.element;
    var layer = layui.layer;
    var laypage = layui.laypage;

    laypage.render({
        elem: 'listpage',
        count: 70 //数据总数，从服务端得到
            ,
        jump: function(obj, first) {
            //obj包含了当前分页的所有参数，比如：
            console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
            console.log(obj.limit); //得到每页显示的条数

            //首次不执行
            if (!first) {
                //do something
            }
        }
    });
});

function showDel(name, no) {
    var layer = layui.layer;

    layer.confirm('确认删除' + name + '？', {
        btn: ['确认', '取消'] //可以无限个按钮
    }, function(index, layero) {
        //按钮【按钮一】的回调
        location.href = 'del/no/' + no;
        console.log(index)
    }, function(index) {
        //按钮【按钮二】的回调
        console.log(index)
    });
}

function showImg() {
    // var img_file =  $("#img_file").val();
    var file = document.getElementById('food_picture').files[0];
    var re = new FileReader();
    re.readAsDataURL(file);
    re.onload = function(re) {
        $('#food_picture').attr("src", re.target.result);
    }
}
</script>
</body>

</html>
</body>

</html>